package TitleScreen;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * Is handling the interactions
 * 
 * @param startView comp, startModel comp
 * @author Thomas Felder
 */

public class startController implements ActionListener {
	//If not specified differently, code by Thomas Felder
	private startView view;
	private startModel model;

	public startController(startView view, startModel model) {
		this.view = view;
		this.model = model;

		view.form.btn_login.addActionListener(this);
		view.form.btn_register.addActionListener(this);

	}

	@Override
	public void actionPerformed(ActionEvent e) {
//no if-else function in case of aditional buttons
		if (e.getActionCommand().equals("Login")) {

			model.login(view.form.txtF_UserName.getText(),view.form.txtF_Password.getText()); //deprecated
		}

		if (e.getActionCommand().equals("Register")) {
			model.register(view.form.txtF_UserName.getText(),view.form.txtF_Password.getText()); //deprecated
		}

	}

}
